package me.send.produce.data.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import me.send.business.base.Pager;
import me.send.data.service.pojo.Comment;
import me.send.data.service.service.CommentService;
import me.send.data.service.service.TreeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "comment")
public class CommentController {

	@Autowired
	private CommentService commentService;
	@Autowired
	private TreeService treeService;

	@RequestMapping(value = "page")
	@ResponseBody
	public Map<String, Object> list_page(Pager pager, Comment comment) {
		return commentService.list_page(pager, comment);
	}

	@RequestMapping(value = "batch/delete")
	@ResponseBody
	public Map<String, Object> batch_delete(String commentids) {
		return commentService.batch_delete(commentids);
	}

	// 查询分页数据
	@RequestMapping(value = "comment/list")
	public ModelAndView list(HttpServletRequest request) {
		// 增加一个连接 2015年6月19日16:57:02
		ModelAndView modelAndView = new ModelAndView(
				"/stage/comment/comment_list");
		modelAndView.addObject("LoadTree",
				treeService.main_tree(0, request, "comment/comment/list"));
		modelAndView.addObject("module", "评价管理");
		return modelAndView;
	}

}
